package network;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;

public class UdpDictServer extends UdpEchoServer{
    private HashMap<String, String> map = new HashMap<>();
    UdpDictServer(int port) throws SocketException {
        super(port);
        map.put("cat", "小猫");
        map.put("dog", "小狗");
        map.put("pig", "小猪");
    }

    @Override
    public String process(String s) {
        return map.getOrDefault(s, "不存在该单词");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer server = new UdpDictServer(1314);
        server.start();
    }
}
